<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Todo:
* images inside links
* Base URL
-->


<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output method="html" indent="yes" />

<xsl:template match="a" mode="href">
	<tr><td><xsl:value-of select="text()" /></td><td><xsl:value-of select="@href" /></td></tr>
</xsl:template>

<xsl:template match="a" mode="name">
	<tr><td><xsl:value-of select="@name" /></td></tr>
</xsl:template>
	
<xsl:template match="/">
<html>
<head>
<title>List of Links</title>
</head>
<body>
<h1>List of links</h1>
<xsl:if test="count(//a[@href]) > 0">
<h2>Links</h2>
<table border="1">
<tr><th>Link Text</th><th>Link href</th></tr>
	<xsl:apply-templates select="//a[@href]" mode="href"/>
</table>
</xsl:if>
<h2>Named Anchors</h2>
<xsl:if test="count(//a[@name]) > 0">
<h2>Links</h2>
<table border="1">
<tr><th>Anchor Name</th></tr>
	<xsl:apply-templates select="//a[@name]" mode="name"/>
</table>
</xsl:if></body>
</html>
</xsl:template>
	
</xsl:stylesheet>